package com.amor.workpcs.controller;

import com.alibaba.fastjson.JSONObject;
import com.amor.workpcs.entity.Company;
import com.amor.workpcs.entity.Staff;
import com.amor.workpcs.service.CompanyService;
import com.amor.workpcs.service.StaffService;
import com.amor.workpcs.utils.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * (Company)表控制层
 *
 * @author makejava
 * @since 2021-09-14 10:25:20
 */
@RestController
@RequestMapping("company")
public class CompanyController {
    /**
     * 服务对象
     */
    @Resource
    private CompanyService companyService;

    @Autowired
    StaffService staffService;


    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectOne")
    public Company selectOne(Integer id) {
        return this.companyService.queryById(id);
    }

    /**
     *
     * @Author: Amor
     * @Date: 15:05 2021/9/14
     * @Description: 定时检查数据更新插入
    */
    @GetMapping("insert")
//    @Scheduled(cron = "0 * * * *")
    public void initInsert(){
        companyService.initInsert();
    }


    @RequestMapping(value = "/init",method = RequestMethod.POST)
    public void init(){
        companyService.init();
    }





}